function request(url, type, data, spell) {
	return new Promise((resolve, reject) => {
		// console.log(__wxConfig.accountInfo.nickname)
		// const appId = uni.getAccountInfoSync().miniProgram.appId
		data = {
			...data
		}
		if (spell) {
			let i = 0
			for (let key in data) {
				if (i == 0) {
					url += '?' + key + '=' + data[key]
				} else {
					url += '&' + key + '=' + data[key]
				}
				i++
			}
		}
		uni.request({
			url: 'https://order.yt-card.top/' + url,
			data: data,
			method: type,
			header: {
				token: uni.getStorageSync('token')
			},
			success: res => {
				if (res.data.code == 200) {
					resolve(res.data)
				} 
				 else{
					uni.showToast({
						title: res.data.msg,
						icon: 'none',
						mask: true,
						position:'bottom'
					})
				}
				if (res.data.code !== 200) {
					resolve(res.data)
				}
			},
			fail: (err) => {
				uni.showToast({
					title: '网络异常',
					icon: 'none',
					mask: true,
				})
				reject(err)
			}
		})
	})
}
module.exports = {
	baseUrl: 'https://console-mock.apipost.cn/mock/acda1889-1fca-412e-a196-27dddd7bd3fawechat/',
	request: request
}